const app = getApp()
const utils = require('../../utils/util.js')
const Monitor = require('../../utils/monitor.js').Monitor
Page(Monitor.hookApp({
  data: {
    current: 0,
    jumpIdx: 0,
    imgUrls: getApp().globalData.imgUrls,
    titleList: ['会员等级', '会员等级', '会员等级']
  },

  //事件处理函数
  bindchange(e) {
    this.setData({
      current: e.detail.current
    })
  },
  request() {
    let pageinFo = getCurrentPages()[getCurrentPages().length - 2]
    utils.API('spwx/v1.Vipcard/authorityDetails', {
      card_id: pageinFo.data.card_id //需要改
    }).then(res => {
      let {code,data,msg} = res
      if(code == 200) {
        let arr = []
        for(let prop in data){
          arr.push(data[prop])
        }
        this.setData({
          resData:arr
        })
      }
    })
  },
  onLoad(o) {
    this.request()
    if (o.idx) { //从会员页点击权益跳进来默认是第几个
      this.setData({
        jumpIdx: parseInt(o.idx)
      })
      this.setData({
        current: parseInt(o.idx)
      })
    }
  }
}))